package casa.depesos.app.com.http;


import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import casa.depesos.app.com.App;
import casa.depesos.app.com.BuildConfig;
import casa.depesos.app.com.utils.Utils;

public interface HttpReq<T extends BaseBean> {

    void req(ReqCallback<T> callback);

    default Map<String, String> getHeader() {
        HashMap<String, String> map = new HashMap<>();
        map.put("release", BuildConfig.VERSION_NAME);
        map.put("tok", Utils.getToken());
        map.put("userid", Utils.getUid());
        map.put("packageName", BuildConfig.APPLICATION_ID);
        return map;
    }

    default Map getBody() {
        HashMap map = new HashMap();
        map.put("mobPre", "52");
        map.put("packageName", App.getApp().getPackageName());
        return map;
    }

    default Map<String, String> getParam() {
        return Collections.emptyMap();
    }

    default void req(String url, BaseParser parser, ReqCallback callback) {
        Req.post(url, getParam(), getHeader(), getBody(), parser, callback, this);
    }

    default boolean pass() {
        return false;
    }
}
